package com.mxue.test;

import com.mxue.App;

import java.util.*;

public class HashDemo {
    public static void main(String[] args) {
        Set setDemo = new HashSet();
        boolean bo1 = setDemo.add("hello");
        boolean bo2 = setDemo.add("hello");

        System.out.println(bo1);
        System.out.println(bo2);

        Map<Object, Object> map = new HashMap<>();
        Object bo21 = map.put("hello", 1);
        Object bo22 = map.put("hello", 2);
        Object bo23 = map.put("hello", 3);

        System.out.println(bo21);
        System.out.println(bo22);
        System.out.println(bo23);

        Set perSet = new HashSet();
        Person p11 = new Person();
        Person p22 = new Person();

        System.out.println(p11);
        System.out.println(p22);
        boolean p1 = perSet.add(p11);
        boolean p2 = perSet.add(p22);
        System.out.println(p1);
        System.out.println(p2);
        System.out.println(perSet.size());

        TreeSet ts = new TreeSet();
        ts.add(1);
        ts.add(3);
        ts.add(2);
        System.out.println(ts.size());
        System.out.println(ts);

    }

    public static class Person {
        private String name;
        private Integer age;


        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getAge() {
            return age;
        }

        public void setAge(Integer age) {
            this.age = age;
        }
    }
}


